import java.awt.Color;
import java.awt.Graphics;
import java.awt.Point;

public class JavaCADUOutputNode extends DrawObject
{
    // DrawObject abilities:
    @Override
    public boolean CanBeDeletedByUser()
    {
        return false;
    };

    @Override
    public boolean CanBeExcitedByUser()
    {
        return true;
    }

    @Override
    public boolean CanBeMovedByUser()
    {
        return false;
    }

    @Override
    public boolean CanBeSelectedByUser()
    {
        return true; // IMPORTANT: JavaCADUOutputNode shall be selectable, to make Ctrl-F7, Ctrl-F8 (auto-connect with Lines) work!
    }
    // end of DrawObject abilities

    public JavaCADUOutputNode(Point Pos)
    {
        SetPosNoAlignOnGrid(Pos);
        SetSize(new Point(10, 10));
        InitializeExcitement(ExcitementOnceMilliseconds);
    };

    @Override
    public void Draw(Graphics g)
    {
        if (!(IsWithinWindowBounds(this, 0)))
            return;

        // background (overdraw grid)
        if (IsHighlighted || IsPartOfMultiSelection)
            SetColor(g, Color.GREEN);
        else
            SetColor(g, Color.LIGHT_GRAY);
        FillRect(g, Pos.x, Pos.y, Size.x, Size.y);

        // frame
        SetColor(g, GetExcitementColor());
        DrawRect(g, Pos.x, Pos.y, Size.x, Size.y);
    }

    protected void ExciteAsPartner(double ExcitementCurrentNew, DrawObject Sender)
    {
        ExcitementCurrent = ExcitementCurrentNew; // ASSIGN with "=", do NOT add with "+="!
    }
}
